<%--
  Created by IntelliJ IDEA.
  User: zkt
  Date: 2023/9/21
  Time: 21:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
    <head>
        <meta charset="UTF-8">
        <link rel="stylesheet" href="css/bootstrap.min.css">
        <link rel="stylesheet" href="css/my.css">
        <script src="js/jquery-3.7.1.min.js"></script>
        <script src="js/popper.min.js"></script>
        <script src="js/bootstrap.min.js"></script>

        <title>注册</title>
    </head>
    <body>
        <div class="container">
            <div class="v-center c-center col-lg-6 col-md-8 col-sm-8 col-xs-10 ">
                <div class="panel panel-info" style="opacity: 0.9;">
                    <div class="panel-heading">
                        <div class="text-center">
                            <h1>欢迎注册</h1>
                            <br>
                            <h4>慕课网售课系统</h4>
                        </div>
                    </div>
                    <div class="panel-body">
                        <br>
                        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                            <!-- 获取注册是否成功信息 -->
                            <p class="text-center text-danger" id="register"></p>
                        </div>
                        <br>
                        <div>
                            <form class="form-horizontal" role="form" method="post" action="/registerServlet">
                                <div class="form-group">
                                    <lable class="control-label col-lg-2 col-md-2 col-sm-2 col-xs-2">账号:</lable>
                                    <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8">
                                        <input type="text" class="form-control" name="account" placeholder="请输入账号" />
                                    </div>
                                </div>
                                <br>
                                <div class="form-group">
                                    <lable class="control-label col-lg-2 col-md-2 col-sm-2 col-xs-2">密码:</lable>
                                    <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8">
                                        <input type="password" class="form-control" name="password" placeholder="请输入密码" />
                                    </div>
                                </div>
                                <br>
                                <div class="form-group">
                                    <lable class="control-label col-lg-2 col-md-2 col-sm-2 col-xs-2">确认密码:</lable>
                                    <div class="col-lg-8 col-md-8 col-sm-8 col-xs-8">
                                        <input type="password" class="form-control" name="passwordTwo" placeholder="请再次输入密码" />
                                    </div>
                                </div>
                                <br>
                                <div class="form-group">
                                    <lable class="control-label col-lg-2 col-md-2 col-sm-2 col-xs-2">验证码:</lable>
                                    <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
                                        <input type="text" class="form-control" name="yzm" placeholder="请输入验证码" />
                                    </div>
                                    <div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
                                        <img id="captchaImage" src="/YZMCodeServlet">
                                        <a style="cursor: pointer" oncopy="return false" oncut="return false;"
                                           onselectstart="return false" oncontextmenu="return false"
                                           onclick="refreshCaptcha()">换一张？</a>
                                    </div>
                                </div>
                                <br>
                                <div class="form-group">
                                    <div class="col-lg-2 col-lg-offset-2 col-md-2 col-md-offset-2 col-sm-2 col-sm-offset-2 col-xs-2 col-xs-offset-2">
                                        <button class="btn btn-success" type="submit">注册</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                        <br>
                        <br>
                        <br>
                    </div>
                </div>
            </div>
        </div>
    </body>
    <script>
        function refreshCaptcha() {
            $.ajax({
                url: "/YZMCodeServlet",
                success: function() {
                    // 刷新验证码图像
                    $("#captchaImage").attr("src", "/YZMCodeServlet?" + new Date().getTime());
                },
                error: function() {
                    console.log("刷新验证码出错");
                }
            });
        }
    </script>
</html>
